var apiUrl = contextPath + "/system/pmoLog//list";
var listVue = new Vue({
	el : '#projectProcdefIndex',
	data : {
		params : {
			pageSize : 10,
			pageNum : 1,
			status : ''
		},
		ppList : [],
		projectList : [],
		processTypeList : [],
		permission : {
			query : true
		}
	},
	mounted : function() {
		this.getList();
	},
	methods : {
		queryList : function() {
			this.params.pageNum = 1;
			this.getList();
		},
		getList : function() {
			var _self = this;
			var loadIndex = layer.load(0, {
				shade : false
			});
			var startTimeStart = $("#startTimeStart").val();
			var startTimeEnd = $("#startTimeEnd").val();
			var params1 = {
				pageSize : this.params.pageSize,
				pageNum : this.params.pageNum,
				status : this.params.status
			};
			if (startTimeStart != "") {
				params1.startTimeStart = startTimeStart;
			}
			if (startTimeEnd != "") {
				params1.startTimeEnd = startTimeEnd;
			}

			$.ajax({
				type : 'post',
				url : apiUrl,
				data : params1,
				dataType : 'json',
				success : function(res) {
					layer.close(loadIndex);
					if (res.res == "1") {
						var rows = res.obj.rows;
						_self.ppList = rows;
						//初始化分页
						var pages = res.obj.totalPages;
						var current = res.obj.pageNumber;
						laypage({
							cont : $('#pagination'), //容器。值支持id名、原生dom对象，jquery对象,
							pages : pages, //总页数
							curr : current,
							skip : true, //是否开启跳页
							skin : 'molv',
							groups : 3, //连续显示分页数
							jump : function(obj, first) {
								if (!first) {
									_self.params.pageNum = obj.curr;
									_self.getList();
								}
							}
						});

					} else {
						layer.close(loadIndex);
						layer.alert(res.resMsg);
					}

				},
				error : function(res) {

				}
			});
		},
		clearForm : function() {
			this.params.status = '';
			$("#startTimeStart").val("");
			$("#startTimeEnd").val("");
		},
		showDetail : function(json) {
			layer.open({
				type : 1,
				title : false,
				shadeClose : true,
				skin : 'layui-layer-rim', //加上边框
				area : [ '800px', '600px' ], //宽高
				content : JSON.stringify(json, undefined, 2)
			});
		}
	}
});
Vue.filter('directionName', function(value) {
	if (value == '0') {
		return 'PMO推送M2';
	} else if (value == '1') {
		return 'M2推送PMO';
	} else if (value == '2') {
		return 'M2推送OA';
	} else if (value == '3') {
		return 'OA数据同步';
	}
	return "";
});
Vue.filter('statusName', function(value) {
	if (value == '0') {
		return '未处理';
	} else if (value == '1') {
		return '成功';
	} else if (value == '2') {
		return '失败';
	}
	return "";
});

Vue.filter('createTimeStr', function(value) {
	return new Date(parseInt(value)).toLocaleString().replace(/年|月/g, "-")
			.replace(/日/g, " ");
})
